package javabase.nio;

import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;

public class PathTest {

    public static void main(String[] args) {
        Path path1 = FileSystems.getDefault().getPath("C:\\apache-tomcat-8.5.27\\conf");
        Path path = Paths.get("C:\\apache-tomcat-8.5.27\\conf");
        System.out.println("file name [" + path.getFileName() +"]" );
        System.out.println("number of name elements [" + path.getNameCount() +"]" );
        System.out.println("parent path name [" + path.getParent().getFileName() +"]" );
        System.out.println("root path name [" + path.getRoot().getFileName() +"]" );
        System.out.println("subPath from root [" + path.subpath(0, 2) +"]" );
    }

}
